package testTP4;

import org.junit.*;
import static org.junit.Assert.*;

import firewall.*
import firewallConfig.*;

class TestLogueo {
	
	@Test
	public void testeaLogueoConDLS() {
		Firewall firewall = 
			FirewallBuilder.configurar {
				regla {
					ip "ORIGEN"
						abrir "200.32.232.21"
					puerto "ORIGEN"
						bloquear 30
					loguear "C:\\Users\\Mauro\\Desktop\\testLog.log"
				}
			}
		
		FirewallMock mock = new FirewallMock();
		mock.agregarFirewall(firewall);
		
		assertTrue(firewall.evaluaPaquete(new Paquete("200.32.232.21","192.168.2.1",80)));
		
		ArchivoLog logueo = mock.obtenerArchivoRecienLogueado();
		
		assertEquals(logueo.nLineasEscritas,1);
		
		assertFalse(firewall.evaluaPaquete(new Paquete("190.3.22.1","192.168.2.1",30)));
		
		assertEquals(logueo.nLineasEscritas,2);
		
		
	}
}
